from  selenium import  webdriver
import time
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()

driver.get("http://localhost:9527/#/login")
#输入
username = driver.find_element(By.NAME,"username")
password = driver.find_element(By.NAME,"password").send_keys("NewWord@9715")
username.send_keys("maliu")

# 获取多个元素find_elements
elements = driver.find_elements(By.TAG_NAME,"input")
print(len(elements))
print('类型',type(elements))
for temp in elements :
  temp.clear()
  temp.send_keys("来来来")

time.sleep(2)

driver.get("http://www.baidu.com")
#By.LINK_TEXT  只能定位a标签
# driver.find_element(By.LINK_TEXT,"AI助手").click()
#xPath
driver.find_element(By.XPATH,"//*[@id='kw']").send_keys("还有谁")
#css选择器
driver.find_element(By.CSS_SELECTOR,"#kw").send_keys("你过来啊")
time.sleep(1)
#模糊匹配
driver.find_element(By.PARTIAL_LINK_TEXT,"助手").click()



time.sleep(3)
driver.quit()
